//
//  PywFileManager.m
//  PywSdk
//
//  Created by jadeYu on 2016/10/27.
//  Copyright © 2016年 zero. All rights reserved.
//

#import "PywFileManager.h"

@implementation PywFileManager
+ (instancetype)manager
{
    static dispatch_once_t onceToken;
    static id manager = nil;
    dispatch_once(&onceToken, ^{
        manager = [[[self class] alloc] init];
    });
    return manager;
}

/*
 * 保存字段
 */
- (void)setFileValue:(id)value forFileKey:(NSString *)key
{
    [[NSUserDefaults standardUserDefaults] setObject:value forKey:key];
    [[NSUserDefaults standardUserDefaults] synchronize];
}
/*
 * 获取字段
 */
- (id)objectForKey:(NSString *)key
{
    if (![[NSUserDefaults standardUserDefaults] objectForKey:key]) {
        return nil;
    }
    return [[NSUserDefaults standardUserDefaults] objectForKey:key];
}
/*
 * 删除字段
 */
- (void)removeObjectForKey:(NSString *)key
{
    [[NSUserDefaults standardUserDefaults] removeObjectForKey:key];
}
@end
